<!doctype html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../vendor/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="../vendor/bootstrap-icons/font/bootstrap-icons.css">
    <title>bs</title>
<body>

<div class="container p-2">
    <div class="row g-2">
        <div class="col-md-6">
            <div class="qtab1"></div>
            <button class="btn btn-success mt-2 btn1">回到当前</button>
        </div>
    </div>
</div>


<script src="../vendor/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="../vendor/jquery/dist/jquery.min.js"></script>
<script src="../vendor/bootstrap-quicktab/dist/js/bootstrap-quicktab.min.js"></script>

<script>
    $(function () {

        new Quicktab({
            selector: '.qtab1',
            tabs: [
                {title: '页面1', url: 'child2.html?a=1', close: false},
                {title: '页面2', url: 'child2.html?a=2', close: false},
                {title: '页面3', url: 'child2.html?a=3'},
                {title: '页面4', url: 'child2.html?a=4'},
                {title: '页面5', url: 'child2.html?a=5'},
                {title: '页面6', url: 'child2.html?a=6'},
                {title: '页面7', url: 'child2.html?a=7'},
                {title: '页面8', url: 'child2.html?a=8'},
                {title: '页面9', url: 'child2.html?a=9'},
                {title: '页面10', url: 'child2.html?a=10'},
            ],
            //quicktab初始化完毕事件
            onInit:function (e){
                // e.target:是当前对象实例，可以调用实例方法
                //为了演示回到当前，初始化完毕，默认滚动到页面1所在位置
                e.target.scrollToTabById(Quicktab.getTabIdByUrl('child2.html?a=1'),false);
            }
        });


        $('.btn1').on('click', function () {
            Quicktab.get('.qtab1').scrollToActiveTab();
        })


    })


</script>

</body>
</html>
